#include <cstdio>
#include <algorithm>
using namespace std;
int main(void){
    int t;
    scanf("%d",&t);
    int n,m;
    while(t--){
        scanf("%d%d",&n,&m);
        if(n%(m+1)){
            printf("first\n");
        }
        else{
            printf("second\n");
        }
    }
    return 0;
}
